package com.zc.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.zc.dao.ITcDao;
import com.zc.domain.DoubleListData;
import com.zc.domain.FaultItem;
import com.zc.domain.FourPointsItem;
import com.zc.domain.Item;
import com.zc.domain.TwoPointsItem;
import com.zc.service.TcService;
import com.zc.service.RedisService;

@Controller
public class TcController {
	@Autowired
	private TcService tcService;
	@Autowired
	private RedisService redisService;
	
	
	@RequestMapping(value = "/getTickCount",method = RequestMethod.POST)
    public @ResponseBody DoubleListData getTickCount(){       	
		String key="tickCountData";
		DoubleListData tickCountData=null;
		if(redisService.hasKey(key)){
			tickCountData=(DoubleListData) redisService.get(key);
		}		
		else {
			tickCountData=tcService.getTickCount();
			redisService.set(key, tickCountData);
		}
		return tickCountData;
    }
}
